package org.yxk.roc;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

public class Producer {
	public static void main(String[] args) throws Exception {
		DefaultMQProducer producer = new DefaultMQProducer("producer1");
		producer.setNamesrvAddr("172.16.59.127:9876");
		producer.start();
		for (int i = 0; i <100; i++) {
			Message msg = new Message("orders",("order"+i).getBytes());
			SendResult result = producer.send(msg);
			System.out.println(result);
			System.out.println(msg+"send out");
			Thread.sleep(100);
		}
		producer.shutdown();
	}
}
